package com.shop.shoppingmall.service.impl;

import com.shop.shoppingmall.dao.ShRefundOrderDao;
import com.shop.shoppingmall.entity.ShRefundOrder;
import com.shop.shoppingmall.service.ShRefundOrderService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 退换货(ShRefundOrder)表服务实现类
 *
 * @author makejava
 * @since 2020-12-03 14:09:29
 */
@Service("shRefundOrderService")
public class ShRefundOrderServiceImpl implements ShRefundOrderService {
    @Resource
    private ShRefundOrderDao shRefundOrderDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public ShRefundOrder queryById(String id) {
        return this.shRefundOrderDao.queryById(id);
    }

    /**
     * 新增数据
     *
     * @param shRefundOrder 实例对象
     * @return 实例对象
     */
    @Override
    public ShRefundOrder insert(ShRefundOrder shRefundOrder) {
        this.shRefundOrderDao.insert(shRefundOrder);
        return shRefundOrder;
    }

    /**
     * 修改数据
     *
     * @param shRefundOrder 实例对象
     * @return 实例对象
     */
    @Override
    public ShRefundOrder update(ShRefundOrder shRefundOrder) {
        this.shRefundOrderDao.update(shRefundOrder);
        return this.queryById(shRefundOrder.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(String id) {
        return this.shRefundOrderDao.deleteById(id) > 0;
    }
}
